package com.soft.knowledge.controller;

import com.soft.knowledge.req.VoteReq;
import com.soft.knowledge.resp.CommonResp;
import com.soft.knowledge.service.VoteService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

@RestController
@RequestMapping("vote")
public class VoteController {
    @Resource
    private VoteService voteService;

    @PostMapping("isVoted")
    public CommonResp isVoted(@RequestBody @Valid VoteReq req){
        CommonResp resp = new CommonResp();
        resp.setContent(voteService.isVoted(req));
        return resp;
    }
}
